package com.service;

import com.mapper.AwardMapper;
import com.service.impl.AwardServiceImpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.when;

/**
 * <p>
 * 获奖信息管理 Service 测试类
 * </p>
 * @author 34448
 */
public class AwardServiceTest {

    @Mock
    private AwardMapper awardMapper;

    @InjectMocks
    private AwardServiceImpl awardService;

    @BeforeEach
    public void setUp() {
        MockitoAnnotations.openMocks(this);
    }

    @Test
    public void testCountAwardsDistribution() {
        List<Map<String, Object>> expected = new ArrayList<>();
        Map<String, Object> map = new HashMap<>();
        map.put("award_name", "Best Project");
        map.put("count", 5);
        expected.add(map);

        when(awardMapper.countAwardsDistribution()).thenReturn(expected);

        List<Map<String, Object>> result = awardService.countAwardsDistribution();
        assertEquals(expected, result);
    }
}